#!/bin/bash

if [ $# -eq 1 ] || [ $# -eq 2 ];then
    version=$1
    registry=$2
else
    echo "$0 version [registry]"
    exit 1
fi

cp -r ~/.ssh ./ssh

if [ -z $registry ];then
    docker build -f cicd/Dockerfile.debug --build-arg version=${version} -t arpc:${version} ./
else
    docker build -f cicd/Dockerfile.release --build-arg registry=${registry} --build-arg version=${version} -t ${registry}/rtc/arpc:${version} ./
fi

rm -rf ./ssh
